/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package layoutitems;

import java.awt.*;

/**
 *
 * @author ST
 */
public class AlphaSquare {

    private static int deltaX=0;
    private Rectangle alphaSquare; //= new Rectangle(gap, gap, width, width);

    public AlphaSquare(int xPos, int yPos, int width, int height){
         this.alphaSquare = new Rectangle(xPos,yPos,width,height);
    }
    
    private static AlphaComposite makeComposite(float alpha) {
        int type = AlphaComposite.SRC_OVER;
        return (AlphaComposite.getInstance(type, alpha));
    }
    public void drawSquare(Graphics2D g2d, float alpha) {
        Composite originalComposite = g2d.getComposite();
        g2d.setComposite(makeComposite(alpha));
        g2d.setPaint(Color.blue);
        g2d.fill(this.alphaSquare);
        g2d.setComposite(originalComposite);
    }
}
